package com.junci.mtest.utils;

import android.content.Context;
import android.content.Intent;

import com.junci.mtest.views.activity.MainActivity;


public class NavigationUtil {


    Intent intent;
    NavigationUtil util;
    Context from;

    /**
     * @param from
     * @param to 跳转 activity
     */
    public static NavigationUtil build(Context from, Class to) {
        Intent intent = new Intent(from, to);
        NavigationUtil util = new NavigationUtil();
        util.setIntent(intent);
        util.setUtil(util);
        util.setFrom(from);
        return util;
    }

    public Context getFrom() {
        return from;
    }

    public void setFrom(Context from) {
        this.from = from;
    }

    public NavigationUtil getUtil() {
        return util;
    }

    public void setUtil(NavigationUtil util) {
        this.util = util;
    }

    public Intent getIntent() {
        return intent;
    }

    public void setIntent(Intent intent) {
        this.intent = intent;
    }

    public void start() {
        from.startActivity(intent);
    }


    // 跳转到主页
    public static void goToMain(Context context) {
        Intent intent = new Intent(context, MainActivity.class);
        context.startActivity(intent);
    }


}